# Contributor: Marvin Preuss <marvin@xsteadfastx.org>
# Maintainer: Marvin Preuss <marvin@xsteadfastx.org>
pkgname=ali
pkgver=0.7.5
# this is used for the help command to print the commit.
# needs to be changed on every release.
_rev=c0aa677
pkgrel=21
pkgdesc="Generate HTTP load and plot the results in real-time"
url="https://github.com/nakabonne/ali"
arch="all"
license="MIT"
options="chmod-clean"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/nakabonne/ali/archive/refs/tags/v$pkgver.tar.gz"

export GOFLAGS="$GOFLAGS -modcacherw"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build \
		-ldflags "
		-X \"main.version=$pkgver\" \
		-X \"main.date=$(date -u "+%Y-%m-%dT%TZ" ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})\" \
		-X \"main.commit=$_rev\" \
		"
}

check() {
	go test ./...
}

package() {
	install -Dm755 $pkgname "$pkgdir"/usr/bin/"$pkgname"
}
sha512sums="
6ae745556bec663abcb2a8d6c5e090fdd5e6b5a8bb889f85c528f749de79eb0e33d794265a801983f8de81629e19a1a38fe147e5095108310b1a353766866ff3  ali-0.7.5.tar.gz
"
